import request from '../utils/request';
import { stringify } from 'qs';
import { baseServerUrl } from '../utils/Constant';

export async function page(params) {
  return request(`${baseServerUrl}/tms/tms-expense/page?${stringify(params)}`, {
    method: 'GET'
  })
}

export async function insertOrUpdate(params) {

  const { id } = params;
  let method = 'PUT';
  if(id === 0){
    method = 'POST';
    delete params['id']
  }
  return request(`${baseServerUrl}/tms/tms-expense`, {
    method: method,
    body: {
      ...params,
    }
  })
}

export async function del(params) {
  return request(`${baseServerUrl}/tms/tms-expense`, {
    method: 'DELETE',
    body: params
  })
}

export async function updateStatus(params) {
  return request(`${baseServerUrl}/tms/tms-expense/status/${params.status}`, {
    method: 'PUT',
    body: params.ids
  })
}

